<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.6.0"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
>

    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
    <cm:property-placeholder persistent-id="org.example.service.database.mybatis" update-strategy="reload">
        <cm:default-properties>
            <cm:property name="repository" value="example/repository"/>
            <cm:property name="servlet.items.name" value="getAllItems"/>
            <cm:property name="servlet.items.alias" value="/items"/>
            <cm:property name="servlet.item.name" value="getItemById"/>
            <cm:property name="servlet.item.alias" value="/item"/>
        </cm:default-properties>
    </cm:property-placeholder>

    <reference id="itemRepository" interface="org.example.service.database.api.ItemRepository"
               ext:filter="(osgi.jndi.service.name=${repository})"/>

    <bean id="servlet" class="org.example.service.whiteboard.Servlet">
        <property name="repository" ref="itemRepository"/>
    </bean>

    <bean id="itemServlet" class="org.example.service.whiteboard.ItemServlet">
        <property name="repository" ref="itemRepository"/>
    </bean>

    <service ref="servlet" interface="javax.servlet.http.HttpServlet">
        <service-properties>
            <entry key="osgi.http.whiteboard.servlet.name" value="${servlet.items.name}"/>
            <entry key="alias" value="${servlet.items.alias}"/>
        </service-properties>
    </service>

    <service ref="itemServlet" interface="javax.servlet.http.HttpServlet">
        <service-properties>
            <entry key="osgi.http.whiteboard.servlet.name" value="${servlet.item.name}"/>
            <entry key="alias" value="${servlet.item.alias}"/>
        </service-properties>
    </service>
</blueprint>